
public class SingleNumberII {

    public static int SingleNumberIITest(int[] num) {
        int sum = 0;
        int result = 0;
        for(int i=0;i<32;i++){
            sum = 0;
            for(int j=0;j<num.length;j++){
                sum += (num[j] & 1<<i)>>i;
            }
            System.out.println(sum);
            result |= (sum%3)<<i;
        }

        return result;
    }
    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        int[] a = {1,1,1,2,2,2,123,123,123,111111};
        System.out.println(SingleNumberIITest(a));
    }
}
